package ishitong.vehicleManagement.service.biz.impl;

import ishitong.vehicleManagement.dao.PhoneyPlateVehicleDao;
import ishitong.vehicleManagement.model.PhoneyPlateVehicle;
import ishitong.vehicleManagement.model.PhoneyPlateVehicleQuery;
import ishitong.vehicleManagement.service.biz.PhoneyPlateVehicleService;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.ishitong.platform.common.page.Page;

/** @pdOid d9d08ce6-ae91-42f8-8ecd-4023bbe6f395
 * @创建日期:2013-09-27 12:15:23
 * 
 * @功能描述:RVIMS_PhoneyPlateVehicle业务服务
 * @开发人员:福建视通 */
@Service(value="phoneyPlateVehicleService")
@Transactional
public class PhoneyPlateVehicleServiceImpl implements PhoneyPlateVehicleService {
   /** @pdOid 4ea094e5-6933-4b5c-85b0-ca0ba0b48e60
       @pdRoleInfo migr=yes name=PhoneyPlateVehicleDao assc=association2 */
   @Autowired
   private PhoneyPlateVehicleDao phoneyPlateVehicleDao;
   /** @pdOid 68b74d07-d698-438b-9103-c4cfbe252b93
       @pdRoleInfo migr=yes name=SPISysCodeService assc=association12 */
   @Autowired
   private SPISysCodeService spiSysCodeService;
   
   /** @param ppv
    * @pdOid eccb90db-f1ca-4620-b5cb-cccb5e155649 */
   private void setPhoneyPlateVehicleProperty(PhoneyPlateVehicle ppv) {
    ppv.setPlateColor(spiSysCodeService.getSysCodeById( ppv.getPlateColorId()));
    ppv.setPlateType(spiSysCodeService.getSysCodeById(ppv.getPlateTypeId()));
    ppv.setUsingCharacter(spiSysCodeService.getSysCodeById(ppv.getUsingCharacterId()));
    ppv.setVehicleClassification(spiSysCodeService.getSysCodeById(ppv.getVehicleClassificationId()));
    ppv.setVehicleColor(spiSysCodeService.getSysCodeById(ppv.getVehicleColorId()));
    ppv.setVehicleType(spiSysCodeService.getSysCodeById(ppv.getVehicleTypeId()));
   }
   
   /** @param id
    * @pdOid 808d1318-2c58-44d0-a394-b49c4a09ecee
    * @功能描述: 删除RVIMS_PhoneyPlateVehicle
    * @异常类型: */
   public void delete(String id) {
   	if(id!=null&&!id.trim().equals("")){
   		String[] idList=id.split(";");
   		for(int i=0;i<idList.length;i++){
   			if(idList[i]!=null&&!idList[i].trim().equals("")){
   				this.phoneyPlateVehicleDao.remove(idList[i]);
   			}
   		}
   	}
   }
   
   /** @param phoneyPlateVehicle
    * @pdOid e13918d0-d845-41e4-a722-fad934645938
    * @功能描述: 删除RVIMS_PhoneyPlateVehicle
    * @异常类型: */
   public void deleteByModel(PhoneyPlateVehicle phoneyPlateVehicle) {
   	this.phoneyPlateVehicleDao.remove(phoneyPlateVehicle);
   }
   
   /** @param id
    * @pdOid d53caeb5-b9f0-4fac-a26a-29de6bbede96
    * @功能描述: 查询RVIMS_PhoneyPlateVehicle
    * @异常类型: */
   public PhoneyPlateVehicle findById(String id) {
   	PhoneyPlateVehicle phoneyPlateVehicle = this.phoneyPlateVehicleDao.findByPrimaryKey(id);
   	setPhoneyPlateVehicleProperty(phoneyPlateVehicle);
   	return phoneyPlateVehicle;
   }
   
   /** @param phoneyPlateVehicle
    * @pdOid 6d090cb5-2fae-4d28-b850-a7267ca9e8ca
    * @功能描述: 新增与修改RVIMS_PhoneyPlateVehicle
    * @异常类型: */
   public void save(PhoneyPlateVehicle phoneyPlateVehicle) {
   	this.phoneyPlateVehicleDao.save(phoneyPlateVehicle);
   }
   
   /** @param query 
    * @param pageSize 
    * @param pageNum
    * @pdOid 5654fa02-97f5-4b28-bbe1-e5e62a04b2fa
    * @功能描述: 通过PhoneyPlateVehicleQuery对象，查询RVIMS_PhoneyPlateVehicle
    * @异常类型: */
   public Page findPage(PhoneyPlateVehicleQuery query, int pageSize, int pageNum) {
      Page<PhoneyPlateVehicle> page = this.phoneyPlateVehicleDao.findPage(query,pageSize,pageNum);
      List<PhoneyPlateVehicle> lst = page.getResults();
      for(PhoneyPlateVehicle ppv: lst){
   	   setPhoneyPlateVehicleProperty(ppv);
      }
   return page;   
     }
   
   /** @param query
    * @pdOid 3a23cb76-6634-4562-a05e-25adb318a1a7
    * @功能描述: 通过PhoneyPlateVehicleQuery对象，查询RVIMS_PhoneyPlateVehicle
    * @异常类型: */
   public List<PhoneyPlateVehicle> findList(PhoneyPlateVehicleQuery query) {
   	return this.phoneyPlateVehicleDao.findList(query);
   }

}